package com.twu.biblioteca.users;

import com.twu.biblioteca.BibliotecaApp;

public class UserSession {

    protected User loggedInUser;
    protected static UserSession userSession;

    public static UserSession getInstance(User user) {
        if(userSession == null)
            userSession = new UserSession(user);

        return userSession;
    }

    public static boolean isUserLoggedIn() {
        return BibliotecaApp.loggedInUser == null;
    }

    protected UserSession(User user){
        this.loggedInUser = user;
    }

    public void displayLoggedInUserDetails() {
        System.out.println(this.loggedInUser.toString());
    }
}
